/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package nl.maxato.modellen;

import java.awt.Checkbox;
import java.util.List;
import javax.swing.table.AbstractTableModel;

import nl.maxato.domain.Athlete;

/**
 *
 * @author Danny
 */
public class AtleetTableModel extends AbstractTableModel {

    private List<Athlete> atleten;
    String[] columnNames = {"Naam", "MAXID",
        "Vorm", "Zorg", "Humeur", "Ervaring",
        "Kracht", "Uithouding", "Snelheid", "Lenigheid", "Springen", "Werpen", "Specialiteit 1", "Specialiteit 2",
        "Totaal waarde"};
    //private Atleet atleet;
    //private List<Usertabel> following;

    public AtleetTableModel(List<Athlete> atleten) {
        this.atleten = atleten;
        //this.atleet = atleet;
        //following = user.getUsertabelCollection();
        //System.out.println("Following: " + atleet.getUsertabelCollection());
    }

       public void setColumnNames(String naam, String MAXID, String vorm, String zorg, String humeur, String ervaring, String kracht, String uithouding, String snelheid, String lenigheid, String springen, String werpen, String specialiteit1, String specialiteit2, String totaalWaarde) {
        String[] columnNamesNieuw = {naam, MAXID, vorm, zorg, humeur, ervaring, kracht, uithouding, snelheid, lenigheid, springen, werpen, specialiteit1, specialiteit2, totaalWaarde};
        this.columnNames = columnNamesNieuw;
    }
    
    @Override
    public int getColumnCount() {
        return 15;
    }

    @Override
    public String getColumnName(int col) {
        return columnNames[col];
    }

    @Override
    public int getRowCount() {
        return atleten.size();
    }

    @Override
    public Object getValueAt(int row, int col) {
        switch (col) {
            case 0:
                return atleten.get(row).getName() + " " + atleten.get(row).getSurname();
            case 1:
                return atleten.get(row).getMaxid();
            case 2:
                return atleten.get(row).getForm();
            case 3:
                return atleten.get(row).getCare();
            case 4:
                return atleten.get(row).getMood();
            case 5:
                return atleten.get(row).getExperience();
            case 6:
                return atleten.get(row).getStrenght();
            case 7:
                return atleten.get(row).getStamina();
            case 8:
                return atleten.get(row).getSpeed();
            case 9:
                return atleten.get(row).getAgility();
            case 10:
                return atleten.get(row).getJump();
            case 11:
                return atleten.get(row).getThrowing();
            case 12:
                return atleten.get(row).getSpecialty1();
            case 13:
                return atleten.get(row).getSpecialty2();
            case 14:
                return atleten.get(row).getTotalValueDiscipline();
            default:
                throw new RuntimeException("no such column");
        }
    }

    // This method is used by the JTable to define the default
    // renderer or editor for each cell. For example if you have
    // a boolean data it will be rendered as a check box. A
    // number value is right aligned.
    @Override
    public Class<?> getColumnClass(int columnIndex) {
        switch (columnIndex) {
            case 0:
                return atleten.get(0).getSurname().getClass();
            case 1:
                return Integer.class;
            case 2:
                return Integer.class;
            case 3:
                return Integer.class;
            case 4:
                return Integer.class;
            case 5:
                return Integer.class;
            case 6:
                return Integer.class;
            case 7:
                return Integer.class;
            case 8:
                return Integer.class;
            case 9:
                return Integer.class;
            case 10:
                return Integer.class;
            case 11:
                return Integer.class;
            case 12:
                return Integer.class;
            case 13:
                return Integer.class;
            case 14:
                return Integer.class;
            default:
                throw new RuntimeException("no such column");
        }
    }
}
